Python Script
A Python Script allows you to write a script for manipulating components, commands and the application using Python programming language (stackless, version 2.7).
Properties
Name | Description |
Name | Defines the name of the script. |
Script | Allows you to view and edit the script in an editor. |
Editor
In order to access the script editor, do one of the following:
- In the Component Graph panel, Component Node Tree, find the Python Script behavior you want to edit, and then double-click that behavior.
- In the Properties panel, click Open In Editor.
The script editor displays line numbers, expand/collapse options for code blocks, and a toolbar.
Name | Description |
Compile | ![]() |
Trace Execution | ![]() |
Run to cursor | ![]() |
Step 1 line | ![]() |
Snippets | ![]() |
Cut | ![]() |
Copy | ![]() |
Paste | ![]() |
Undo | ![]() |
Redo | ![]() |
Background | ![]() |
Find | ![]() |
Find Next | ![]() |
Find Previous | ![]() |
Highlight All Matches | ![]() |
Clear Highlights | ![]() |
Snippets
The initial content of the editor contains a code snippet that allows you to use the properties, methods and events of the script's behavior:
from vcScript import * def OnSignal( signal ): pass def OnRun(): pass |
If the text area is active, you can press CTRL+J to insert a snippet of code.
Word Completion
The editor allows you to use autocomplete for certain types of cases. For example, if the text area is active, you can press CTRL+SPACEBAR to display options for completing a line of code.
If you use autocomplete, you may be able to read documentation about the added item.
Drag and drop elements into Python Script
When editing a Python Script behavior, you can drag and drop elements from certain application panels into the editor.
Supported application panels include:
- Cell Graph panel.
- Product Type Editor panel.
- Component Graph Node Tree and Feature Tree.
- Program Editor panel.
The drag and drop functionality includes the following features:
- Drag and drop of a single element inserts the label surrounded by single quotes. Note: The drop action is undoable in the editor.
- Holding Shift or CTRL to multi-select elements allows multiple elements to be dropped at once.
-
Holding Shift when dropping elements adds extra "getter" code e.g. comp.getProperty('MyProp').
The following table lists drag and drop feature compatiblity across supported applications panels.
Name | Drag and drop a single element | Multi-select multiple elements to be dropped at once | Holding Shift when dropping adds extra "getter" code |
Cell Graph | ✔ | ✔ | ✔ |
Product Type Editor | ✔ | ❌ | ❌ |
Component Graph Node Tree | ✔ | ❌ | ✔ |
Component Graph Feature Tree | ✔ | ✔ | ✔ |
Program Editor | ✔ | ✔ | ❌ |